//
//  CloudViewController.swift
//  CheckmeRing
//
//  Created by 董鹏 on 2022/2/27.
//

import UIKit

class CloudViewController: RViewController {

    @IBOutlet weak var tableView: UITableView!
    
    let data = ["Historyクラウドアップロード", "Dashboardクラウドアプロード"]
    
    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.backgroundColor = hexColor("F9F9F9")
        self.tableView.register(UINib.init(nibName: "ScreenTableViewCell", bundle: Bundle.main), forCellReuseIdentifier: "ScreenTableViewCell")
        self.tableView.layer.cornerRadius = 8
        self.tableView.separatorStyle = .none
        self.tableView.isScrollEnabled = false
        self.tableView.rowHeight = ScreenRowHeight
    }

}

extension CloudViewController: UITableViewDelegate, UITableViewDataSource {
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return self.data.count
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "ScreenTableViewCell") as! ScreenTableViewCell
        cell.selectionStyle = .none
        cell.accessoryType = .disclosureIndicator
        cell.titleLabel.text = data[indexPath.row]
        cell.separLine.isHidden = indexPath.row == data.count - 1
        cell.selectIcon.isHidden = true
        return cell
    }
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if indexPath.row == 0 {
            let vc = getStoryBoardVC(identifier: "HistoryUploadViewController")
            self.navigationController?.pushViewController(vc, animated: true)
        }
        if indexPath.row == 1 {
            let vc = getStoryBoardVC(identifier: "DashboardUploadViewController")
            self.navigationController?.pushViewController(vc, animated: true)
        }
    }
    
}
